/***************************************************************************
*   Copyright (C) 2011 by Chuck Gao & Alex Liu                             *
*                                                                          *
*   This program is free software: you can redistribute it and/or modify   *
*   it under the terms of the GNU General Public License as published by   *
*   the Free Software Foundation, either version 3 of the License, or      *
*   (at your option) any later version.                                    *
*                                                                          *
*   This program is distributed in the hope that it will be useful,        *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
*   GNU General Public License for more details.                           *
*                                                                          *
*   You should have received a copy of the GNU General Public License      *
*   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
*                                                                          *
*   Contact author: chuckgao.cg@gmail.com                                  *
*                   alex2202375@gmail.com                                  *
***************************************************************************/

import QtQuick 1.0
import com.nokia.symbian 1.1
import Qt.labs.components 1.1
import "../CookingBasicWidget"

Rectangle {
    id: cookingMethodBook
    width: parent.width
    height: stepImage.height + stepContent.height + indicator.height + recipeTabView.contextMargin
    color: Qt.rgba(200,100,40,0.2)
    border.color: Qt.rgba(255,255,255,0.2)
    border.width: 2
    radius: 20

    property int currentPageNum: 1
    property int margin: 4

    Column {
        anchors.top: parent.top
        anchors.topMargin: margin * 2
        anchors.bottom: indicator.top

        Image {
            id: stepImage
            width: cookingMethodBook.width - margin * 4
            height: cookingMethodBook.width - margin * 4
            x: margin * 2
            source: "qrc:/Images/kungpao.jpg"
            smooth: true
        }

//        TextEdit {
//            id: stepContent
//            width: cookingMethodBook.width - margin * 2
//            height: 80
//            x: margin
//            font.pointSize: 14
//            wrapMode: TextEdit.Wrap
//            cursorVisible: false
//            readOnly: true
//            clip: true
//            smooth: true
//            text: "先用一个蛋白、盐半茶匙及太白粉2大匙搅拌均匀，调成“腌料”备用。再用酱油1大匙、米酒1茶匙、太白粉水1大匙、糖1/2茶匙、盐1/4茶匙、酱色及白醋1茶匙、麻油2大匙、蒜末1/2茶匙调拌均匀，调成“综合调味料”"
//        }

        TextArea {
            id: stepContent
            width: cookingMethodBook.width - margin * 2
            height: stepContent.paintedHeight
            x: margin
            platformMaxImplicitWidth: cookingMethodBook.width - margin * 2
            font.family: "Freestyle Script"
            font.pointSize: 32
//                    color: "white"
            wrapMode: TextEdit.Wrap
            readOnly: true
            text: "先用一个蛋白、盐半茶匙及太白粉2大匙搅拌均匀，调成“腌料”备用。再用酱油1大匙、米酒1茶匙、太白粉水1大匙、糖1/2茶匙、盐1/4茶匙、酱色及白醋1茶匙、麻油2大匙、蒜末1/2茶匙调拌均匀，调成“综合调味料”"
        }
    }

    PageIndicator {
        id: indicator
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 4
        anchors.horizontalCenter: parent.horizontalCenter
        pageCount: 5
        currentNum: currentPageNum
    }

    Rectangle {
        id: prevBtn
        width: 60
        height: 30
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 10
        color: "violet"

        Text {
            anchors.centerIn: parent
            text: "Prev"
            font.family: "Helvetica"
            font.pointSize: 12
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            color: "white"
        }

        MouseArea {
            anchors.fill: parent
            onClicked: {
                indicator.currentNum--;
                stepImage.source  = "qrc:/cookingImage/kungpao.jpg";
                stepContent.text  = "先用一个蛋白、盐半茶匙及太白粉2大匙搅拌均匀，调成“腌料”备用。再用酱油1大匙、米酒1茶匙、太白粉水1大匙、糖1/2茶匙、盐1/4茶匙、酱色及白醋1茶匙、麻油2大匙、蒜末1/2茶匙调拌均匀，调成“综合调味料”";
            }
        }
    }

    Rectangle {
        id: nextBtn
        width: 60
        height: 30
        anchors.right: parent.right
        anchors.rightMargin: 10
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 10
        color: "violet"

        Text {
            anchors.centerIn: parent
            text: "Next"
            font.family: "Helvetica"
            font.pointSize: 12
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            color: "white"
        }

        MouseArea {
            anchors.fill: parent
            onClicked: {
                indicator.currentNum++;
                stepImage.source  = "qrc:/cookingImage/hamburger.png";
                stepContent.text  = "鸡胸肉先切成约1公分的方块状碎丁。切好的鸡丁用“腌料”搅拌均匀，腌渍半小时。鸡丁腌好以后，烧热5杯色拉油，先将鸡丁倒入锅内，用大火快炸半分钟";
            }
        }
    }
}
